<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浮动</title>
</head>
<style>
    .parent {
        background-color: red;
        /* overflow: hidden; */
    }
    p {
        margin: 0;
        float: left;
    }
    .parent div:first-child {
        float: left;
    }
    .parent::after {
        display: block;
        content: '';
        clear: both;
    }

</style>
<body>
    <div class="parent">
        <div>静夜思</div>
        <p>李白</p>
        <!-- <div style="clear: both;content: '';"></div> -->
    </div>
</body>
</html>